package com.dragon.modules.yuegou.model.coupon;

import java.math.BigDecimal;
import java.util.List;

public class CouponDiscountCombin {

	/** 券优惠金额 */
	private BigDecimal couponDiscountFee;

	/** 券优惠绝对值 */
	private BigDecimal discountAbs;

	/** 券列表 */
	private List<Coupon> couponList;

	public void buildCombin(List<Coupon> couponList, BigDecimal allowSkuFee) {
		this.couponList = couponList;
		BigDecimal discountFee = couponList.stream().map(Coupon::getReductionMount).reduce(BigDecimal.ZERO, BigDecimal::add);
		this.couponDiscountFee = allowSkuFee.compareTo(discountFee) >= 0 ? discountFee : allowSkuFee;
		discountAbs = discountFee.subtract(allowSkuFee).abs();
	}

	public BigDecimal getCouponDiscountFee() {
		return couponDiscountFee;
	}

	public void setCouponDiscountFee(BigDecimal couponDiscountFee) {
		this.couponDiscountFee = couponDiscountFee;
	}

	public BigDecimal getDiscountAbs() {
		return discountAbs;
	}

	public void setDiscountAbs(BigDecimal discountAbs) {
		this.discountAbs = discountAbs;
	}

	public List<Coupon> getCouponList() {
		return couponList;
	}

	public void setCouponList(List<Coupon> couponList) {
		this.couponList = couponList;
	}

}
